Repository navigation
fix(libc): set ERANGE for decimal subnormals in wcstod as strtod does - #11892
Conversation
MarcZX10
left a comment
There was a problem hiding this comment.
I reviewed the delegation and the errno rule: wcstod still parses the ASCII prefix and maps endptr through ParseAsciiPrefix, while the delegated strtod_nid_postfix adds the same decimal nonzero-subnormal ERANGE behavior as strtod. I built and ran guest_math on native Linux using this PR's exact Strings.cpp and GuestMath.cpp changes; 1/1 passed. The hosted Windows build also passes, along with conventions and the Linux relinker checks. I found no blocking issue in this focused change. The console libSceLibcInternal behavior remains explicitly documented as unmeasured.
|
Linux run at this PR's exact head Arch Linux, kernel 7.2.9, Ryzen 9 7950X, g++ (GCC) 16.2.1 20260810, glibc 2.44, x86-64. Release, Passed in each of 3 runs, exit code 0 each time, with no failed, skipped or not-run tests:
These are the focused tests only; no title or console was used. AI-assisted: yes (Claude Code). |
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
01f6372 to
6219aaa
Compare
|
Rebased onto
Exact source pins, preservation proofs, dependency checks, build logs and JUnit, SHA-256 AI-assisted: yes. |
|
@JJenkx #12291 has now landed in main as At this PR's current The AI-assisted: yes (Codex). |
wcstod parsed through the host strtod directly, so a decimal input with a nonzero subnormal result left errno alone, where strtod sets ERANGE. The wcstod of the libc.prx bundled with eleven titles sets it in the same cases as their strtod: 1e-310, the smallest subnormal and 1e-330 set it, 2.2250738585072014e-308 and 0x1p-1074 do not, and 0x1.8p-1075 does. wcstod now parses through strtod. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
6219aaa to
f6ca899
Compare
|
Refreshed against main Linux qualification at The combined debt entry retains the decimal wcstod qualification, the PPSA08329-only hexadecimal measurements and glibc 2.35 rounding limitation from merged #12291, with console wcstod still unmeasured. The focused set includes inherited hexadecimal-underflow cases and wide-string conversions. No new title measurements are claimed. Evidence: immutable Linux qualification bundle. Its SHA-256 is AI-assisted: yes. |
What
strtodsetsERANGEfor a decimal input whose result is a nonzero subnormal (#9833).wcstodparses through the hoststrtoddirectly, so it skips that rule and leaveserrnoalone. Thewcstodof thelibc.prxthat titles ship setsERANGEin the same cases as itsstrtod.wcstodnow parses throughstrtod, as #9833 offered as a follow-up.Tested
Windows 11 Enterprise 10.0.22621, Ryzen 9 5950X, WinLibs GCC 15.2.0 UCRT r7, Ninja, Release,
BUILD_TESTING=ON,main8ff4baf.libc.prxof eleven titles natively: PPSA04158, PPSA05916, PPSA07923, PPSA09614, PPSA13934, PPSA20423, PPSA25636, PPSA26528, PPSA33655, PPSA34008 and PPSA35169.Measured cases:
errno1e-310000012688b70e62bERANGE-4.9406564584124654e-3248000000000000001ERANGE1e-3300ERANGE2.2250738585072014e-30800100000000000000x1p-107410x1.8p-10751ERANGE-0x1.000001p-10758000000000000001ERANGETheir
wcstodgives these results, and all eleven setERANGEfor1e-310,4.9406564584124654e-324and0x1.8p-1075.Random strings: 100,000 random decimal strings in the subnormal range (exponents -300 to -329) went through PPSA07923's
wcstodandmain's.maindiffers on 40,900, every one inerrno.strtodmatches on all 100,000, which shows the rulewcstodnow reuses.guest_math:CheckFloatUnderflowErrnogains the sevenwcstodcases above.guest_mathandguest_wide_stringspass in three runs out of three on the exact head.main'sStrings.cppand these tests,guest_mathaborts (exit 0xc0000409).python tools/check_conventions.py --base origin/mainandgit diff --checkpass.libSceLibcInternal.sprxwcstod(the debt entry keeps that as unmeasured), Linux and macOS (the change is target-independent).Current Linux qualification (2026-10-28)
Rebased onto
main2227f1366188cda5699dd20e2e756a18006a5d4b. Linux CPU validation on 2026-10-28 at6219aaaff1520be4d484d6b618c3c3977024be58(Arch Linux 7.2.9, AMD Ryzen 9 7950X, GCC 16.2.1, Ninja Release, BUILD_TESTING=ON).libc,guest_math_testsandguest_math_exact_testsrebuilt from this exact source.guest_mathandguest_math_exacteach passed three consecutive runs (6/6, no skips); the same two suites each passed three runs on the pinned main (6/6). Conventions and whitespace checks pass.Exact source pins, preservation proofs, dependency checks, build logs and JUnit, SHA-256
1176269c9e6948b5252a5db9e660978d7f978fb2d9f4ed6c68bc050b10b5ae68. This is focused Linux CPU qualification; earlier Windows/title/reference measurements retain their original pins. No new title or performance result is claimed.Current Linux qualification — 2026-10-29
Refreshed against main
5454cd2e455994d992aca39335ce60507eeda1eb.Linux qualification at
f6ca8993e813d818781a29f86148c52f58df4d4b(Arch Linux 7.2.9, Ryzen 9 7950X, GCC 16.2.1, Ninja Release, BUILD_TESTING=ON):guest_math,guest_math_exact,guest_dinkumware_internals,guest_wide_strings,guest_strtod_subnormal,guest_wide_conversioneach pass three consecutive runs (18/18, no skips). Thepublic_headersaudit passes at this exact head. All tracked public-header files match the pinned main; the affected test targets rebuild against those headers. Conventions and whitespace checks pass. The same focused groups passed three times on the pinned main.The combined debt entry retains the decimal wcstod qualification, the PPSA08329-only hexadecimal measurements and glibc 2.35 rounding limitation from merged #12291, with console wcstod still unmeasured. The focused set includes inherited hexadecimal-underflow cases and wide-string conversions. No new title measurements are claimed.
Evidence: immutable Linux qualification bundle. Its SHA-256 is
53b095da2f67f55b8aa56ba273681e0330fb39739be844458038dde410fb8cc4. No fresh Windows runtime execution is claimed; older measurements retain their recorded source pins.AI-assisted: yes (Codex).
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)AI-assisted (Claude Code).